package com.qiqijuice.sales;

import net.miginfocom.swt.MigLayout;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;

public class OperationsView extends Composite {

	public static int EVT_NEW_ORDER = 0x3000;
	public static int EVT_DEL_ORDER = 0x3001;
	public static int EVT_CLOSE_ORDER = 0x3002;
	
	public OperationsView(Composite parent) {
		super(parent, SWT.None);
		
		setLayout(new MigLayout("wrap 1",""));
		
		Button b = new Button(this, SWT.PUSH);
		b.setText("New Order");
		b.setLayoutData("width 120, height 120, sg 1");
		b.addSelectionListener(new SelectionAdapter() {

			@Override
			public void widgetSelected(SelectionEvent e) {
				notifyListeners(EVT_NEW_ORDER, new Event());
			}
			
		});
		
		b = new Button(this, SWT.PUSH);
		b.setText("Close Order");
		b.setLayoutData("sg 1");
		b.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				notifyListeners(EVT_CLOSE_ORDER, new Event());
			}
		});
		
		b = new Button(this, SWT.PUSH);
		b.setText("Delete Order");
		b.setLayoutData("sg 1");
		b.addSelectionListener(new SelectionAdapter() {

			@Override
			public void widgetSelected(SelectionEvent e) {
				notifyListeners(EVT_DEL_ORDER, new Event());
			}
			
		});		
	}
	
}
